package com.huiyeji.dynamic.core;

import com.huiyeji.dynamic.core.builder.DynamicBuilder;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Huiyeji
 */
public class GlobalBeanRegistry {

    protected final List<DynamicObject> dynamicObjects = new ArrayList<>();

    public void register(Object object){
        dynamicObjects.add(DynamicBuilderManager.Anno.build(object));
    }

    public void register(String name, Object object){
        DynamicObject dynamicObject = DynamicBuilderManager.Anno.build(object);
        dynamicObject.setDynamicObjectName(name);
        dynamicObjects.add(dynamicObject);
    }

    public void register(DynamicObject dynamicObject){
        dynamicObjects.add(dynamicObject);
    }

    public void registerBuilder(DynamicBuilder builder){
        register(builder);
    }
}
